<template>
  <!-- 热映电影列表 -->
  <div class="hot-showing">
    <ul class="list">
      <router-link
        tag="li"
        :to="`/details/${movie.id}`"
        v-for="movie in movieList"
        :key="movie.id"
      >
        <!-- 左边图片 -->
        <div class="left">
          <img :src="movie.img" alt="" />
        </div>
        <!-- 中间 -->
        <div class="con">
          <p>
            {{ movie.nm }}
            <img
              v-if="movie.version == 'v3d'"
              src="https://s0.meituan.net/bs/myfe/canary/file/touchnode/images/dpmmweb/hot-tab/img/base64/v3d.png"
              width="17px"
              height="14px"
            />
            <img
              v-if="movie.version == 'v2d imax'"
              src="https://s0.meituan.net/bs/myfe/canary/file/touchnode/images/dpmmweb/hot-tab/img/base64/v2dimax.png"
              width="43px"
              height="14px"
            />
          </p>
          <p>
            观众评<span>{{ movie.sc }}</span>
          </p>
          <p>主演：{{ movie.star }}</p>
          <p>{{ movie.showInfo }}</p>
        </div>
        <!-- 右间 -->
        <div class="right">
          <button :style="`backgroundColor:${movie.showStateButton.color}`">
            {{ movie.showStateButton.content == "购票" ? "购票" : "预售" }}
          </button>
        </div>
      </router-link>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      movieList: null,
    };
  },
  // 热映列表
  created() {
    this.axios.get("index/movieOnInfoList").then((re) => {
      // console.log("热映列表", re);
      this.movieList = re.movieList;
      // console.log(this.movieList);
    });
  },
};
</script>

<style lang="scss" scoped>
.hot-showing {
  width: 100%;
  height: 200px;
  margin-top: 10px;
  .list {
    padding-bottom: 50px;
    width: 100%;
    li {
      background-color: #fff;
      border: 1px solid #f5f5f5;
      padding: 10px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      // 图片
      .left {
        margin-right: 10px;
        img {
          width: 64px;
          height: 90px;
        }
      }
      // 中间
      .con {
        flex: 1;
        p {
          font-size: 13px;
          line-height: 14px;
          color: #666;
          margin-bottom: 5px;

          width: 50vw;
          text-overflow: ellipsis;
          overflow: hidden;
          white-space: nowrap;
          &:nth-child(1) {
            margin-bottom: 10px;
            font-size: 17px;
            line-height: 18px;

            color: #333;
            font-weight: 700;
            padding-right: 0.1rem;
            flex-shrink: 1;
          }
          &:nth-child(2) {
            span {
              margin-left: 5px;
              font-weight: 700;
              color: #faaf00;
              font-size: 0.3rem;
            }
          }
        }
      }
      // 购票
      .right {
        width: 50px;
        text-align: center;
        button {
          border: none;
          background: none;

          width: 54px;
          height: 28px;
          border-radius: 30px;

          font-size: 14px;
          font-weight: bold;
          color: #fff;

          background-color: #f03d37;
        }
      }
    }
  }
}
</style>